#include <dt-bindings/gpio/gpio.h>
#include "lito-audio-overlay.dtsi"
#include "lito-pmic-overlay.dtsi"
#include "camera/lito-camera-sensor-mtp.dtsi"
#include "lito-sde-display.dtsi"
#include "lito-thermal-overlay.dtsi"

&soc {
	gpio_keys {
		compatible = "gpio-keys";
		label = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&key_vol_up_default>;

		vol_up {
			label = "volume_up";
			gpios = <&pm8150l_gpios 5 GPIO_ACTIVE_LOW>;
			linux,input-type = <1>;
			linux,code = <KEY_VOLUMEUP>;
			gpio-key,wakeup;
			debounce-interval = <15>;
			linux,can-disable;
		};
	};

	vdda_usb_ss_dp_core: vdda_usb_ss_dp_core {
		compatible = "regulator-fixed";
		regulator-name = "vdd_supply";
		regulator-min-microvolt = <880000>;
		regulator-max-microvolt = <880000>;
		enable-active-high;
		gpio = <&pm8150l_gpios 12 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&usb_eldo13>;
	};

	mtp_batterydata: qcom,battery-data {
		qcom,batt-id-range-pct = <15>;
		#include "qg-batterydata-alium-3600mah.dtsi"
		#include "qg-batterydata-atl466271_3300mAh.dtsi"
	};
};

&usb_qmp_dp_phy {
	vdd-supply = <&vdda_usb_ss_dp_core>;
};

&sde_dp {
	vdda-0p9-supply = <&vdda_usb_ss_dp_core>;
};

&ufsphy_mem {
	compatible = "qcom,ufs-phy-qmp-v4-lito";

	vdda-phy-supply = <&pm8150_l5>;
	vdda-pll-supply = <&pm8150_l9>;
	vdda-phy-max-microamp = <90200>;
	vdda-pll-max-microamp = <19000>;

	status = "ok";
};

&ufshc_mem {
	vdd-hba-supply = <&ufs_phy_gdsc>;
	vdd-hba-fixed-regulator;
	vcc-supply = <&pm8150a_l7>;
	vcc-voltage-level = <2950000 2960000>;
	vccq2-supply = <&pm8150_s4>;
	vcc-max-microamp = <800000>;
	vccq2-max-microamp = <800000>;

	qcom,vddp-ref-clk-supply = <&pm8150_l9>;
	qcom,vddp-ref-clk-max-microamp = <100>;
	qcom,vddp-ref-clk-min-uV = <1152000>;
	qcom,vddp-ref-clk-max-uV = <1200000>;
	status = "ok";
};

&sdhc_1 {
	vdd-supply = <&pm8150a_l7>;
	qcom,vdd-voltage-level = <2950000 2950000>;
	qcom,vdd-current-level = <0 570000>;

	vdd-io-supply = <&pm8150_s4>;
	qcom,vdd-io-always-on;
	qcom,vdd-io-lpm-sup;
	qcom,vdd-io-voltage-level = <1800000 1800000>;
	qcom,vdd-io-current-level = <0 325000>;

	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on
					&sdc1_rclk_on>;
	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off
					&sdc1_rclk_off>;

	status = "ok";
};

&sdhc_2 {
	vdd-supply = <&pm8150a_l9>;
	qcom,vdd-voltage-level = <2950000 2950000>;
	qcom,vdd-current-level = <0 800000>;

	vdd-io-supply = <&pm8150a_l6>;
	qcom,vdd-io-voltage-level = <1800000 2950000>;
	qcom,vdd-io-current-level = <0 22000>;

	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&sdc2_clk_on  &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;

	cd-gpios = <&tlmm 69 GPIO_ACTIVE_LOW>;

	status = "ok";
};

&pm8150a_amoled {
	status = "ok";
};

&pm7250b_vadc {
	pinctrl-0 = <
		&bmr_w_therm_default
		&camera_therm_default
		&bmr_s_therm_default
	>;

	bmr_s_therm {
		reg = <ADC_GPIO3_PU2>;
		label = "bmr_s_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};
};

&pm7250b_gpios {
	bmr_s_therm {
		bmr_s_therm_default: bmr_s_therm_default {
			pins = "gpio5";
			bias-high-impedance;
		};
	};
};

&pm7250b_adc_tm {
	io-channels = <&pm7250b_vadc ADC_AMUX_THM1_PU2>,
			<&pm7250b_vadc ADC_GPIO2_PU2>,
			<&pm7250b_vadc ADC_GPIO3_PU2>,
			<&pm7250b_vadc ADC_GPIO4_PU2>;

	bmr_s_therm@54 {
		reg = <ADC_GPIO3_PU2>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};
};

&thermal_zones {
	mmw-pa4-usr {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm7250b_adc_tm ADC_GPIO3_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};

&pm7250b_charger {
	status = "ok";
	io-channels = <&pm7250b_vadc ADC_USB_IN_V_16>,
		      <&pm7250b_vadc ADC_USB_IN_I>,
		      <&pm7250b_vadc ADC_CHG_TEMP>,
		      <&pm7250b_vadc ADC_DIE_TEMP>,
		      <&pm7250b_vadc ADC_AMUX_THM3_PU2>,
		      <&pm7250b_vadc ADC_SBUx>,
		      <&pm7250b_vadc ADC_VPH_PWR>,
		      <&pm7250b_vadc ADC_AMUX_THM1_PU2>;
	io-channel-names = "usb_in_voltage",
			   "usb_in_current",
			   "chg_temp",
			   "die_temp",
			   "conn_temp",
			   "sbux_res",
			   "vph_voltage",
			   "skin_temp";
	qcom,battery-data = <&mtp_batterydata>;
	qcom,sec-charger-config = <1>;
	qcom,auto-recharge-soc = <98>;
	qcom,step-charging-enable;
	qcom,sw-jeita-enable;
	qcom,charger-temp-max = <800>;
	qcom,smb-temp-max = <800>;
	qcom,suspend-input-on-debug-batt;
	qcom,fcc-stepping-enable;
	qcom,fcc-step-delay-ms = <100>;
	qcom,fcc-step-size-ua = <100000>;
	qcom,smb-internal-pull-kohm = <0>;
	qcom,en-skin-therm-mitigation;
	qcom,hvdcp3-standalone-config;
};

&pm7250b_qg {
	status = "ok";
	io-channels = <&pm7250b_vadc ADC_BAT_THERM_PU2>,
		      <&pm7250b_vadc ADC_BAT_ID_PU2>;
	io-channel-names = "batt-therm",
			   "batt-id";
	qcom,battery-data = <&mtp_batterydata>;
	qcom,qg-iterm-ma = <100>;
	qcom,hold-soc-while-full;
	qcom,linearize-soc;
	qcom,cl-feedback-on;
	qcom,tcss-enable;
	qcom,fvss-enable;
	qcom,fvss-vbatt-mv = <3300>;
	qcom,bass-enable;
};

&qupv3_se7_i2c {
	#address-cells = <1>;
	#size-cells = <0>;

	status = "ok";
	qcom,i2c-touch-active = "st,fts";

	st_fts@49 {
		compatible = "st,fts";
		reg = <0x49>;
		interrupt-parent = <&tlmm>;
		interrupts = <9 0x2008>;
		vdd-supply = <&pm8150_s4>;
		avdd-supply = <&pm8150_l13>;
		pinctrl-names = "pmx_ts_active", "pmx_ts_suspend";
		pinctrl-0 = <&ts_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
		st,irq-gpio = <&tlmm 9 0x2008>;
		st,reset-gpio = <&tlmm 8 0x00>;
		st,regulator_dvdd = "vdd";
		st,regulator_avdd = "avdd";
		st,x-flip = <1>;
		st,y-flip = <1>;
		st,power_on_suspend;
		panel = <&dsi_sw43404_amoled_cmd &dsi_sw43404_amoled_video
			 &dsi_sw43404_amoled_fhd_plus_cmd>;
	};
};

&dsi_sw43404_amoled_video {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,mdss-dsi-bl-min-level = <1>;
	qcom,mdss-dsi-bl-max-level = <1023>;
	qcom,mdss-brightness-max-level = <255>;
	qcom,platform-te-gpio = <&tlmm 10 0>;
	qcom,platform-reset-gpio = <&pm8150l_gpios 3 0>;
};

&dsi_sw43404_amoled_cmd {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,mdss-dsi-bl-min-level = <1>;
	qcom,mdss-dsi-bl-max-level = <1023>;
	qcom,mdss-brightness-max-level = <255>;
	qcom,platform-te-gpio = <&tlmm 10 0>;
	qcom,platform-reset-gpio = <&pm8150l_gpios 3 0>;
};

&dsi_sw43404_amoled_fhd_plus_cmd {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,mdss-dsi-bl-min-level = <1>;
	qcom,mdss-dsi-bl-max-level = <1023>;
	qcom,mdss-brightness-max-level = <255>;
	qcom,platform-te-gpio = <&tlmm 10 0>;
	qcom,platform-reset-gpio = <&pm8150l_gpios 3 0>;
};

&sde_dsi {
	qcom,dsi-default-panel = <&dsi_sw43404_amoled_video>;
};

&qupv3_se0_i2c {
	status = "ok";
	qcom,clk-freq-out = <1000000>;
	#address-cells = <1>;
	#size-cells = <0>;
	nq@28 {
		compatible = "qcom,nq-nci";
		reg = <0x28>;
		qcom,nq-irq = <&tlmm 34 0x00>;
		qcom,nq-ven = <&tlmm 12 0x00>;
		qcom,nq-firm = <&tlmm 35 0x00>;
		qcom,nq-clkreq = <&tlmm 31 0x00>;
		interrupt-parent = <&tlmm>;
		interrupts = <34 0>;
		interrupt-names = "nfc_irq";
		pinctrl-names = "nfc_active", "nfc_suspend";
		pinctrl-0 = <&nfc_int_active &nfc_enable_active
				&nfc_clk_req_active>;
		pinctrl-1 = <&nfc_int_suspend &nfc_enable_suspend
				&nfc_clk_req_suspend>;
	};
};

&dsi_sim_cmd {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,platform-reset-gpio = <&pm8150l_gpios 3 0>;
};

&dsi_sim_vid {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,platform-reset-gpio = <&pm8150l_gpios 3 0>;
};

&dsi_dual_sim_cmd {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,platform-reset-gpio = <&pm8150l_gpios 3 0>;
};

&dsi_dual_sim_vid {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
	qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs";
	qcom,platform-reset-gpio = <&pm8150l_gpios 3 0>;
};

